# Maintainer: Ryuta Suzuki <oroppas@gmail.com>

_realname=et-xmlfile
pkgbase=mingw-w64-python-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-python-${_realname}")
provides=("${MINGW_PACKAGE_PREFIX}-python3-${_realname}")
conflicts=("${MINGW_PACKAGE_PREFIX}-python3-${_realname}")
replaces=("${MINGW_PACKAGE_PREFIX}-python3-${_realname}")
pkgver=1.0.1
pkgrel=1
pkgdesc="A low memory library for creating large XML files (mingw-w64)"
url="https://et-xmlfile.readthedocs.io/"
arch=('any')
license=('MIT')
depends=("${MINGW_PACKAGE_PREFIX}-python-lxml")
makedepends=("${MINGW_PACKAGE_PREFIX}-python-setuptools")
source=("https://pypi.python.org/packages/source/e/et_xmlfile/et_xmlfile-${pkgver}.tar.gz"
        "LICENSE")
sha256sums=('614d9722d572f6246302c4491846d2c393c199cfa4edc9af593437691683335b'
            '69a810ce7342b9198bd2e44d0098e30b4ce31078019e6cf990a5cd6ce2c3f7ce')

prepare() {
  cd "${srcdir}"
  rm -rf python-build-${CARCH} | true
  cp -r "et_xmlfile-${pkgver}" "python-build-${CARCH}"
}

build() {
  cd "${srcdir}/python-build-${CARCH}"
  ${MINGW_PREFIX}/bin/python setup.py build
}

package() {
  cd "${srcdir}/python-build-${CARCH}"

  MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \
  ${MINGW_PREFIX}/bin/python setup.py install --root=${pkgdir} --prefix=${MINGW_PREFIX} --optimize=1 --skip-build

  install -Dm644 ${srcdir}/LICENSE ${pkgdir}${MINGW_PREFIX}/share/licenses/python-${_realname}/LICENSE
}
